﻿@using FTBS.Models.Entities;
@model List<FTBS.Models.Entities.Chair>
@{
    ViewBag.Title = "Sửa Phòng";
    Room room =  (Room)ViewBag.Room;
    Layout = "~/Views/Shared/_AdminLayout.cshtml";
}

<div style="display:block;border-bottom:1px solid #ddd;margin-bottom:10px">
    <div id="picked4" style="display:none">@Html.DisplayFor(model => model[0].RoomId)</div>
<div>@room.RoomName</div>
Diện tích :
 <input type="text" id="txtHori" style="width:20px;border:none" value="@room.MaxLength" disabled />x
 <input type="text" id="txtVeri" style="width: 20px;border:none" value="@room.MaxHeight" disabled />
    </div>

<div style="display:block;border-bottom:1px solid #ddd;margin-bottom:10px;padding-bottom:10px">
    <div style="margin:0 auto;"><img src="~/Image/Icon/board.png" style="height:60px;width:70%;display:block;margin:auto" /></div> 
    <div style="overflow-x:auto">
    <table id="desk2" style="margin: 0 auto">
        @for (var i = 0; i < 20; i++)
        {
            var str = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
            <tr>
                @foreach (var item in Model)
                {
                    if (item.ChairPosition.Contains(str[i]))
                    {
                        if (item.IsDeleted == false)
                        { 
                    <td class="seat seat_choose" style="color: floralwhite ;font-size:12px;padding-top:8px;padding-right:10px;text-align:center">
                        <div style="padding-bottom:5px;padding-left:3px">@Html.DisplayFor(modelItem => item.ChairPosition)</div>
                    
                        <select id="@item.ChairPosition.ToString()">
                            @foreach (var type in (List<ChairType>)ViewBag.ChairType)
                            {
                                if (item.ChairTypeId == type.ChairTypeId)
                                {
                                    <option value="@type.ChairTypeId" selected>@type.TypeName</option>
                                }
                                else
                                {
                                    <option value="@type.ChairTypeId">@type.TypeName</option>
                                }
                            }
                        </select>
                        <div class="chairId" style="display: none">
                            @Html.DisplayFor(modelItem => item.ChairId)
                        </div>
                        <div class="chairType" style="display: none">
                            @Html.DisplayFor(modelItem => item.ChairType.TypeName)
                        </div>

                    </td>      
                        }
                        else if (item.IsDeleted == true)
                        {
                      <td class="seat" style="color: floralwhite ;font-size:12px;padding-top:8px;padding-right:10px;text-align:center">
                             <div style="padding-bottom:5px;padding-left:3px">@Html.DisplayFor(modelItem => item.ChairPosition)</div>
                             <select id="@item.ChairPosition.ToString()">
                            @foreach (var type in (List<ChairType>)ViewBag.ChairType)
                            {
                                if (item.ChairTypeId == type.ChairTypeId)
                                {
                                    <option value="@type.ChairTypeId" selected>@type.TypeName</option>
                                }
                                else
                                {
                                    <option value="@type.ChairTypeId">@type.TypeName</option>
                                }
                            }
                        </select>
                         </td>
                        }

                    }
                }
            </tr>                }
    </table>
        </div>
</div>

 <input type="button" class="btn info" style="width:77px" onclick="editChair()" value="Lưu" />
<button class="button danger" style="float:right">@Html.ActionLink("Quay lại", "Index")</button>
     
<div id="picked2" style="height:20px;width:100px;overflow-y:auto;opacity:0"></div>
<div id="picked3" style="height:20px;width:100px;overflow-y:auto;opacity:0"></div>
    
<div id="wrapper">
    <div style="display: none;" id="overlay"></div>
    <div style="display: none;" id="popup">
        <img src="~/Image/Icon/loading.gif" />
        <div style="font-weight: bold">Đang xử lý thao tác ...</div>
    </div>
</div>

<script>
    $(document).ready(addRowHandlers3());
</script>
    

<style>
    #wrapper {
        width: 600px;
        margin: 10px auto;
        text-align: center;
    }

    #overlay {
        background: #000000;
        opacity: 0.5;
        bottom: 0;
        left: 0;
        position: fixed;
        right: 0;
        top: 0;
        z-index: 10000;
    }

    #popup {
        background: none repeat scroll 0 0 #FFFFFF;
        border: 20px solid #DDDDDD;
        left: 37.5%;
        padding: 50px;
        position: fixed;
        text-align: center;
        top: 28%;
        width: 280px;
        z-index: 20000;
        -moz-border-radius: 30px 0;
    }
</style>